
_hkgname=mutable-containers
pkgname=haskell-mutable-containers
pkgver=0.3.4.1
pkgrel=36
pkgdesc='Abstactions and concrete implementations of mutable containers'
arch=(loong64 x86_64)
url="https://hackage.haskell.org/package/$_hkgname"
license=(MIT)
depends=(ghc-libs haskell-vector haskell-mono-traversable)
makedepends=(ghc)
checkdepends=(haskell-quickcheck haskell-hspec)
source=("https://hackage.haskell.org/packages/archive/$_hkgname/$pkgver/$_hkgname-$pkgver.tar.gz")
sha512sums=('24c4dfbb95bfbe6c1c0972f092a0402d21725b88dd5d0136e3397d801d18f753449757649f008e3befd509faba58b5bb5c703337adbde7a83431386f9b291255')

build() {
  cd $_hkgname-$pkgver    
    
  runhaskell Setup configure -O --enable-shared --enable-executable-dynamic --disable-library-vanilla \
      --prefix=/usr --docdir=/usr/share/doc/$pkgname --datasubdir=$pkgname --enable-tests \
      --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid --ghc-option=-fllvm
  runhaskell Setup build $MAKEFLAGS
  runhaskell Setup register --gen-script
  runhaskell Setup unregister --gen-script
  sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
  sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
}

check() {
  cd $_hkgname-$pkgver
  runhaskell Setup test --show-details=direct
}

package() {
  cd $_hkgname-$pkgver

  install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh
  install -D -m744 unregister.sh "$pkgdir"/usr/share/haskell/unregister/$pkgname.sh
  runhaskell Setup copy --destdir="$pkgdir"
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
  rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE
}

# vim: ts=2 sw=2 et:
